home *** CD-ROM | disk | FTP | other *** search
/ PC-SIG: World of Games / PC-SIG World of Games (CDRM1080710) (1993).iso / ENT / DISK2468.ZIP / MM / POPUP.H < prev    next >
Text File  |  1990-03-30  |  3KB  |  89 lines

  1. /*    Text mode popup window package (popup.h)    */
  2.  
  3. /*    Center window code    */
  4. #define    CTRWIN    999
  5.  
  6. /*    video ram text-cell structure */
  7. typedef struct texel_struct {
  8.     unsigned char ch;
  9.     unsigned char attr;
  10. } texel;
  11.  
  12. /*    A structure to hold the box type, and a set of window colors */
  13. typedef struct wincolors_struct {
  14.     char border_type;
  15.     unsigned char border_color, text_color, title_color, hilite_color;
  16.     } wincolors;
  17.  
  18. /*    popup windows save the image underneath, tiled windows don't */
  19. enum windowtype {popup, tile};
  20.  
  21. /* A structure to hold information for each window */
  22. typedef struct winstruct {
  23.     char *name;        /* window title */
  24.     void *image;    /* ptr to image save area */
  25.     struct winstruct *under, *over; /* ptrs to window below and above
  26.                                                                     on popup stack */
  27.     wincolors wc;                        /* colors for the window */
  28.     char xul,yul,xlr,ylr,wd,ht;    /* window coord's and sizes */
  29.     char xsave,ysave;                    /* saved cursor position */
  30.     enum windowtype wtype;
  31. } windesc;
  32.  
  33. extern windesc        *base_win;        /* can be used to access whole screen */
  34. extern windesc        *curr_win;        /* current window in use */
  35. extern wincolors    defcolors;        /* predefined color sets */
  36. extern wincolors    invcolors;
  37. extern wincolors    monocolors;
  38. extern wincolors    errcolors;
  39. extern wincolors    msgcolors;
  40. extern wincolors    graycolors;
  41.  
  42. /* macros for easy use in removing and selecting window */
  43. #define rmv_win(w)    view_win(w,0)
  44. #define slct_win(w)    view_win(w,1)
  45.  
  46. /* Now the prototypes for the popup functions */
  47. extern void init_win(void);
  48. extern windesc *draw_win(int x, int y, int wd, int ht, char *title,
  49.                                     enum windowtype wt, wincolors *wc);
  50. extern void view_win(windesc *this, int move_to_top);
  51. extern void clr_win(void);
  52. extern void draw_box(int xul,int yul,int xlr,int ylr,int btype,int attr);
  53. extern void centerstr(int xul,int yul,int xlr,int ylr,char *s, unsigned char a);
  54. extern void mprintf(char *fmt,...);
  55. extern void prtfstr(int x,int y,char *fmt,unsigned char attr, int wd,...);
  56. extern void swap_image(windesc *w);
  57.  
  58. /* Includes for sayerr.c */
  59. /* the first set of macros include line number and name of source file */
  60. #define SWRNF    0,1,__LINE__,__FILE__
  61. #define SERRF    0,2,__LINE__,__FILE__
  62. #define SMSGF    0,0,__LINE__,__FILE__
  63. #define FWRNF    1,1,__LINE__,__FILE__
  64. #define FERRF    1,2,__LINE__,__FILE__
  65. #define FMSGF    1,0,__LINE__,__FILE__
  66.  
  67. /* the second set do not */
  68. #define SWRN    0,1,0,""
  69. #define SERR    0,2,0,""
  70. #define SMSG    0,0,0,""
  71. #define FWRN    1,1,0,""
  72. #define FERR    1,2,0,""
  73. #define FMSG    1,0,0,""
  74.  
  75. extern int errx;        /* default error coordinates */
  76. extern int erry;
  77. extern windesc *errw;    /* error window pointer */
  78. extern int msgx;            /* same for messages */
  79. extern int msgy;
  80. extern windesc *msgw;
  81. extern void numnewlines(char *s,int *n,int *w);
  82. extern void popmsg(int x, int y, char *msg, char *title,
  83.                             char soundout, wincolors *wc);
  84. extern void reperr(int level, char *msg);
  85. extern void repmsg(char *msg);
  86. extern void sayerr(int ferr,int errflag,int lno,char *pname,char *fmt,...);
  87. extern void beep(void);
  88. extern unsigned int getkey(void);
  89.